<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="com.baoyanghui.config.Configs"%>
<%@page import="com.baoyanghui.model.Merchant"%>
<%@page import="com.baoyanghui.common.DataChanger"%>
<%@page import="com.baoyanghui.model.MerchantPlace"%>
<%@page import="java.util.List"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="com.baoyanghui.common.InterfaceAccess" %>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% 
	JSONObject profile = null;
	JSONObject places = null;
	Merchant merchant = null;
	MerchantPlace place = null;
	List<MerchantPlace> placeList = null;
	Map<String, String> params = new HashMap<String, String>();
	
	try {
		request.setCharacterEncoding("UTF-8");
		params.put("merchant_id", (String)session.getAttribute(Configs.SESSION_USER_ID));
		params.put("usercode", (String)session.getAttribute(Configs.SESSION_USERCODE));
		
		profile = InterfaceAccess.callInterface("/merchant/get_profile", params);
		places = InterfaceAccess.callInterface("/merchant/get_places", params);
		merchant = DataChanger.getMerchant(profile);
		placeList = DataChanger.getPlaces(places);
		
		if (merchant == null) {
			response.sendRedirect("login.jsp");
			return;
		}
	} catch (Exception e) {
		response.sendRedirect("login.jsp");
		return;
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<script type="text/javascript" src="../js/merchant_user.js"></script>
		<title>宝养汇</title>
	</head>
	<body>
		<jsp:include page="../common/header.jsp"></jsp:include>
		<div id="div_content">
			<div align="left" style="background: url(../image/bg_merchant_detail.png);">
				<div style="width: 680px; height: 150px; background: gray;">
					<img src="<%= InterfaceAccess.InterfaceContext + "/image/uploads/" + merchant.getPhotos().get(0) %>"
						width="100px" height="100px" style="float: left; margin-top: 12px; margin-left: 10px;"></img>
					<div style="float: left; margin-top: 20px; margin-left: 10px;">
						<p><%= merchant.getCorporationName() %></p>
						<p><%= merchant.getOfficeTel() %></p>
					</div>
					<div style="clear: both;"></div>
				</div>
				<div style="width: 680px; min-height: 120px; margin-top: 12px; background: gray;">
					<h6 style="margin-left: 10px;">简介：</h6>
					<p style="margin-left: 10px; word-break: break-all;"><%= merchant.getIntroduction() %></p>
				</div>
				<div style="width: 680px; height: 1px; margin-top: 12px; background: gray;"></div>
				<div style="width: 680px; height: 520px; margin-top: 12px; background: gray;"></div>
			</div>
		</div>
		<jsp:include page="../common/footer.jsp"></jsp:include>
	</body>
</html>